// Tags:
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

const int N = 3e5 + 5, inf = 0x3f3f3f3f;
int n, w, a[N], buk[N];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("seq.in", "r", stdin);
  freopen("seq.out", "w", stdout);
#endif
#endif

  read(n), read(w);
  int ans = inf;
  for (int i = 1; i <= n; ++i) read(a[i]);
  for (int i = 0; i <= w / n; ++i) {
    memset(buk, 0, sizeof(buk));
    for (int k = 1; k <= n; ++k) {
      if (a[k] - k * i > 0) ++buk[a[k] - k * i];
    }
    for (int j = 1; j <= w; ++j) ans = std::min(ans, n - buk[j]);
  }
  printf("%d", ans);
  return 0;
}